<script setup lang="ts">
import { Tips, JumpPath } from "@/utils/index";
import { Debounce, debounceImmediate } from "@/utils/validate";
import footerBtn from "@/components/footerBtn/index.vue";
import { useTheme } from "@/composables/useTheme";
import { setCategoryItem, getPolicyItemDetail } from "@/api/quotation";
import { onLoad, onReady, onShow } from "@dcloudio/uni-app";
import { hidePageNavInWechatBrowser } from "@/composables/useHiddenNavbar";
import hideWechatMenu from "@/composables/hideWechatMenu";
onShow(() => {
  hideWechatMenu();
});
onReady(() => {
  hidePageNavInWechatBrowser();
});
const { colorStyle } = useTheme();
let detailId = ref(0);
let policyId = ref(0);
let saleMarket = ref({});
let saleMarket2 = ref({});
let dataInfo = reactive({}); //回显所需数据
let is_type = ref(1); //品类类型  1默认；2旧料
onLoad((option) => {
  if (option.id) {
    detailId.value = option.id;
    getPolicyDetailHanlder();
  }
  if (option.is_type) {
    is_type.value = option.is_type;
    if (option.is_type == 2) {
      saleSwitch.value = false;
    }
  }
  if (option.policyId) policyId.value = option.policyId;
  uni.$on("chooseHandler", (item: any) => {
    saleMarket.value = item;
    console.log(item, "销售选择的行情内容");
  });
  uni.$on("askChooseHandler", (item: any) => {
    saleMarket2.value = item;
    console.log(item, "回购选择的行情内容");
  });

  uni.$on("saleJson", (data) => {
    is_sale_json.value = data.formula;
    premiumVal.value = data.premiumVal;
  });
  uni.$on("buybackJson", (data) => {
    is_buyback_json.value = data.formula;
    premiumVal2.value = data.premiumVal;
  });
});

function getPolicyDetailHanlder() {
  const params = { id: detailId.value };
  getPolicyItemDetail(params).then((res) => {
    dataInfo = res.data;
    setDefaultData();
  });
}
// let is_sale_json = ref("(【JZJ_au】+ 加减价) * (100/100)");
// let is_buyback_json = ref("(【JZJ_au】+ 加减价) * (100/100)");
let is_sale_json = ref("");
let is_buyback_json = ref("");
let is_sale_fixed_price = ref("");
let is_buyback_fixed_price = ref("");
// 修改策略回显数据
function setDefaultData() {
  let findIndexTemp = 0;
  // 星期
  const weekArr = dataInfo.week.split(",");
  tabList.value.forEach((item) => {
    weekArr.forEach((_item) => {
      if (item.id == _item) item.checked = true;
    });
  });
  // 时间
  time1.value = dataInfo.start_time;
  time2.value = dataInfo.end_time;

  // 销售部分
  // 开关
  saleSwitch.value = !!dataInfo.is_sale;

  is_sale_json.value = dataInfo.is_sale_json;
  // 报价方式
  findIndexTemp = quotationRadioList.value.findIndex(
    (item) => item.value == dataInfo.is_sale_way
  );
  quotationRadioCurrent.value = findIndexTemp > -1 ? findIndexTemp : 0;
  // 跟随行情
  saleMarket.value.id = dataInfo.is_sale_market;
  // 加减方式
  premiumRadioCurrent.value = premiumRadioList.value.findIndex(
    (item) => item.value == dataInfo.is_sale_premium
  );
  // 加减价值
  premiumVal.value = dataInfo.is_sale_premium_val;
  // 小数点位数
  pointRadioCurrent.value = pointRadioList.value.findIndex(
    (item) => item.value == dataInfo.is_sale_decimal
  );
  is_sale_fixed_price.value = dataInfo.is_sale_fixed_price;
  fractionalRatio.value = dataInfo.is_sale_fractional_ratio;
  // 回购部分
  // 开关
  bakeBuySwitch.value = !!dataInfo.is_buyback;

  is_buyback_json.value = dataInfo.is_buyback_json;
  // 报价方式
  findIndexTemp = quotationRadioList2.value.findIndex(
    (item) => item.value == dataInfo.is_buyback_way
  );
  quotationRadioCurrent2.value = findIndexTemp > -1 ? findIndexTemp : 0;

  // 跟随行情
  saleMarket2.value.id = dataInfo.is_buyback_market;
  // 加减方式
  premiumRadioCurrent2.value = premiumRadioList.value.findIndex(
    (item) => item.value == dataInfo.is_buyback_premium
  );
  // 加减价值
  premiumVal2.value = dataInfo.is_buyback_premium_val;
  // 小数点位数
  pointRadioCurrent2.value = pointRadioList.value.findIndex(
    (item) => item.value == dataInfo.is_buyback_decimal
  );
  is_buyback_fixed_price.value = dataInfo.is_buyback_fixed_price;
  fractionalRatio2.value = dataInfo.is_buyback_fractional_ratio;
}
let tabCurrent = ref(0);
let tabList = ref([
  {
    id: 1,
    week: "周一",
    checked: false,
  },
  {
    id: 2,
    week: "周二",
    checked: false,
  },
  {
    id: 3,
    week: "周三",
    checked: false,
  },
  {
    id: 4,
    week: "周四",
    checked: false,
  },
  {
    id: 5,
    week: "周五",
    checked: false,
  },
  {
    id: 6,
    week: "周六",
    checked: false,
  },
  {
    id: 0,
    week: "周日",
    checked: false,
  },
]);

function changeTab(item: any) {
  item.checked = !item.checked;
  console.log(tabList.value, "----");
}

let timeShow1 = ref(false);
let time1 = ref("");
function bindTimeChange1(e) {
  time1.value = e.value;
  console.log(e, "----");
  closeTime1();
}
function closeTime1() {
  timeShow1.value = false;
}
let timeShow2 = ref(false);
let time2 = ref("");
function bindTimeChange2(e) {
  time2.value = e.value;
  closeTime2();
}
function closeTime2() {
  timeShow2.value = false;
}
function isCheckWeek() {
  return tabList.value.some((item) => item.checked);
}

let saleSwitch = ref(true);
let bakeBuySwitch = ref(true);
function bakeBuySwitchChange() {
  // console.log(switchValue.value);
}
function saleSwitchChange() {
  // console.log(switchValue.value);
}

let fractionalRatio = ref(100);
let premiumVal = ref(1);
function checkWeekArr() {
  return tabList.value.filter((item) => item.checked);
}
// 添加策略按钮事件
const addStrategy = debounceImmediate(addHandler, 500);
function addHandler() {
  if (!isCheckWeek()) return Tips({ title: "请选择日期" });
  if (!time1.value || !time2.value) return Tips({ title: "请选择时间" });

  uni.showLoading();
  let params = {
    id: detailId.value,
    policy_id: policyId.value,
    week: checkWeekArr()
      .map((item) => item.id)
      .join(","),
    start_time: time1.value,
    end_time: time2.value,
    is_sale: saleSwitch.value ? 1 : 0,
    is_sale_way: quotationRadioList.value[quotationRadioCurrent.value].value, //销售 报价方式 1默认 2高级
    is_sale_market: saleMarket.value.id, //销售 - 行情类型
    is_sale_premium: premiumRadioList.value[premiumRadioCurrent.value].value, //销售 加减方式 1百分百 2数值/绝对值
    is_sale_premium_val: premiumVal.value, //销售 加减价值
    is_sale_fractional_ratio: fractionalRatio.value, //销售默认模式百分比值
    is_sale_decimal: pointRadioList.value[pointRadioCurrent.value].value, //销售 保留小数点 可选值 0,1,2,3位
    is_sale_json: is_sale_json.value, //销售 行情json数据 报价方式 高级模式下传入
    is_sale_fixed_price: is_sale_fixed_price.value, //销售 - 固定价

    is_buyback: bakeBuySwitch.value ? 1 : 0, //回购 1显示销售 0 不显示
    is_buyback_way:
      quotationRadioList2.value[quotationRadioCurrent2.value].value, //回购 报价方式 1默认 2高级
    is_buyback_market: saleMarket2.value.id, //回购 - 行情类型
    is_buyback_premium:
      premiumRadioList2.value[premiumRadioCurrent2.value].value, //回购 加减方式 1百分百 2数值/绝对值
    is_buyback_decimal: pointRadioList2.value[pointRadioCurrent2.value].value, //回购 保留小数点 可选值 0,1,2,3位
    is_buyback_json: is_buyback_json.value, //回购 行情json数据
    is_buyback_premium_val: premiumVal2.value, //回购加减价值
    is_buyback_fractional_ratio: fractionalRatio2.value, //回购默认模式百分比值
    is_buyback_fixed_price: is_buyback_fixed_price.value, //回购 - 固定价
  };

  setCategoryItem(params)
    .then((res) => {
      Tips(
        { title: res.info || "修改成功" },
        {
          tab: 3,
        }
      );
      uni.$emit("getItemHandler");
      initData();
    })
    .catch(() => {
      uni.hideLoading();
    });
}
function initData() {
  tabCurrent.value = 0;
  time1.value = "";
  time2.value = "";
}

// 销售报价方式单选数据
let quotationRadioCurrent = ref(0);
const quotationRadioList = ref([
  {
    name: "默认",
    value: "1",
  },
  {
    name: "高级",
    value: "2",
  },
  {
    name: "固定价",
    value: "3",
  },
]);
function quotationRadioChange(evt: any) {
  for (let i = 0; i < quotationRadioList.value.length; i++) {
    if (quotationRadioList.value[i].value === evt.detail.value) {
      quotationRadioCurrent.value = i;
      break;
    }
  }
  console.log(quotationRadioList.value[quotationRadioCurrent.value]);
  console.log(is_sale_json.value, "销售高级算法");
}

// 加减方式单选数据
let premiumRadioCurrent = ref(0);
const premiumRadioList = ref([
  {
    name: "百分比",
    value: "1",
  },
  {
    name: "数值",
    value: "2",
  },
]);
function premiumRadioChange(evt: any) {
  for (let i = 0; i < premiumRadioList.value.length; i++) {
    if (premiumRadioList.value[i].value === evt.detail.value) {
      premiumRadioCurrent.value = i;
      break;
    }
  }
  console.log(premiumRadioList.value[premiumRadioCurrent.value]);
}

// 小数点位数单选框索引&列表
let pointRadioCurrent = ref(1);
const pointRadioList = ref([
  {
    name: "三位",
    value: "3",
  },
  {
    name: "两位",
    value: "2",
  },
  {
    name: "一位",
    value: "1",
  },
  {
    name: "无",
    value: "0",
  },
]);
function pointRadioChange(evt: any) {
  for (let i = 0; i < pointRadioList.value.length; i++) {
    if (pointRadioList.value[i].value === evt.detail.value) {
      pointRadioCurrent.value = i;
      break;
    }
  }
  console.log(pointRadioList.value[pointRadioCurrent.value]);
}

// 回购数据部分
// 销售报价方式单选数据
let quotationRadioCurrent2 = ref(0);
let quotationRadioList2 = ref([
  {
    name: "默认",
    value: "1",
  },
  {
    name: "高级",
    value: "2",
  },
  {
    name: "固定价",
    value: "3",
  },
]);
function quotationRadioChange2(evt: any) {
  for (let i = 0; i < quotationRadioList2.value.length; i++) {
    if (quotationRadioList2.value[i].value === evt.detail.value) {
      quotationRadioCurrent2.value = i;
      break;
    }
  }
}

// 销售加减方式单选数据
let premiumRadioCurrent2 = ref(0);
const premiumRadioList2 = ref([
  {
    name: "百分比",
    value: "1",
  },
  {
    name: "数值",
    value: "2",
  },
]);
function premiumRadioChange2(evt: any) {
  for (let i = 0; i < premiumRadioList.value.length; i++) {
    if (premiumRadioList2.value[i].value === evt.detail.value) {
      premiumRadioCurrent2.value = i;
      break;
    }
  }
}

let fractionalRatio2 = ref(100);
let premiumVal2 = ref(-1);
// 小数点位数单选框索引&列表
let pointRadioCurrent2 = ref(1);
const pointRadioList2 = ref([
  {
    name: "三位",
    value: "3",
  },
  {
    name: "两位",
    value: "2",
  },
  {
    name: "一位",
    value: "1",
  },
  {
    name: "无",
    value: "0",
  },
]);
function pointRadioChange2(evt: any) {
  for (let i = 0; i < pointRadioList2.value.length; i++) {
    if (pointRadioList2.value[i].value === evt.detail.value) {
      pointRadioCurrent2.value = i;
      break;
    }
  }
  console.log(pointRadioList2.value[pointRadioCurrent2.value]);
}

// 解决销售步进器全删后自动变为最低值start-------------
const premiumValChange = Debounce(premiumValDebounce, 1500);
function premiumValDebounce(e) {
  console.log(e, "premiumValChange--------");
  premiumVal.value = e;
}
function premiumValBlur(e) {
  const blurVal = e.detail.value;

  if (blurVal === "") {
    // 输入框什么也不输入的情况，恢复初始值
    setTimeout(() => {
      premiumVal.value = dataInfo.is_sale_premium_val;
      console.log("计时器", dataInfo.is_sale_premium_val, premiumVal.value);
    }, 300);
  }
}
// 解决销售步进器全删后自动变为最低值end-------------
// 解决回购步进器全删后自动变为最低值start-------------
const premiumVal2Change = Debounce(premiumVal2Debounce, 1500);
function premiumVal2Debounce(e) {
  premiumVal2.value = e;
}
function premiumVal2Blur(e) {
  const blurVal = e.detail.value;

  if (blurVal === "") {
    // 输入框什么也不输入的情况，恢复初始值
    setTimeout(() => {
      premiumVal2.value = dataInfo.is_buyback_premium_val;
    }, 300);
  }
}
// 解决回购步进器全删后自动变为最低值end-------------

// 限制销售百分比输入框最大值为100
function onFractionalRatio1Input(e: any) {
  let value = e.detail.value;
  // 如果输入的值大于100，则限制为100
  if (value > 100) {
    fractionalRatio.value = 100;
  }
}
// 限制回购百分比输入框最大值为100
function onFractionalRatio2Input(e: any) {
  let value = e.detail.value;
  // 如果输入的值大于100，则限制为100
  if (value > 100) {
    fractionalRatio2.value = 100;
  }
}
</script>
<template>
  <view class="wrap" :style="colorStyle">
    <view class="tab_list">
      <view
        class="tab_item pad1020"
        :class="{ active: item.checked }"
        v-for="(item, index) in tabList"
        :key="index"
        @click="changeTab(item)"
      >
        {{ item.week }}
      </view>
    </view>
    <view class="pop_time mgt16 flex_sb">
      <view
        class="time_pop_item"
        @click="timeShow1 = true"
        :class="{ dark_font: time1 }"
      >
        {{ time1 || "开始时间" }}
      </view>

      <view class="line"></view>
      <view
        class="time_pop_item"
        :class="{ dark_font: time2 }"
        @click="timeShow2 = true"
      >
        {{ time2 || "结束时间" }}
      </view>
    </view>
    <view class="set_item mgt16 flex_sb" v-if="is_type == 1">
      <text class="red_color">销售</text>
      <up-switch
        inactiveColor="rgb(178, 189, 194)"
        activeColor="var(--view-theme)"
        size="20"
        v-model="saleSwitch"
        @change="saleSwitchChange"
      ></up-switch>
    </view>
    <template v-if="saleSwitch && is_type == 1">
      <!-- 销售管理设置 -->
      <view class="set_item mgt16 flex_sb">
        <text class="label_name">报价方式</text>
        <radio-group @change="quotationRadioChange" class="radio_group flex_s">
          <label
            class="radio_item flex_s"
            v-for="(item, index) in quotationRadioList"
            :key="item.value"
            :class="{ active: index === quotationRadioCurrent }"
          >
            <view>
              <radio
                color="rgb(38, 120, 255)"
                :value="item.value"
                :checked="index === quotationRadioCurrent"
              />
            </view>
            <view>{{ item.name }}</view>
          </label>
        </radio-group>
      </view>
      <template
        v-if="
          quotationRadioList[quotationRadioCurrent].value ===
          quotationRadioList[0].value
        "
      >
        <view
          class="set_item mgt16 flex_sb"
          @click="
            JumpPath('/pages/basicSet/quotationManagementSon/followMarket')
          "
        >
          <text>跟随行情</text>
          <view class="right_info flex_s">
            <view v-if="saleMarket.id">
              <text v-if="saleMarket.id">{{ saleMarket.id }}</text
              ><text v-if="saleMarket.name">-{{ saleMarket.name }}</text>
            </view>

            <text v-else>请选择</text>
            <text class="iconfont icon-xiangyou"></text>
          </view>
        </view>

        <view class="set_item mgt16 flex_sb">
          <text class="label_name">加减方式</text>
          <radio-group @change="premiumRadioChange" class="radio_group flex_s">
            <label
              class="radio_item flex_s"
              v-for="(item, index) in premiumRadioList"
              :key="item.value"
              :class="{ active: index === premiumRadioCurrent }"
            >
              <view>
                <radio
                  color="rgb(38, 120, 255)"
                  :value="item.value"
                  :checked="index === premiumRadioCurrent"
                />
              </view>
              <view>{{ item.name }}</view>
            </label>
          </radio-group>
        </view>
        <view class="set_item mgt16">
          <view class="last_item flex_s">
            <view
              v-if="
                premiumRadioList[premiumRadioCurrent].value ==
                premiumRadioList[0].value
              "
            >
              <text class="green_font">实时行情</text> X (<text
                class="green_font"
                >1</text
              >+<text class="blue_font">加减 </text>%) X
            </view>
            <view v-else>
              (<text class="green_font">实时行情</text>+<text class="blue_font"
                >加减 </text
              >) X
            </view>
            <view class="input_box flex_s">
              <input
                type="digit"
                placeholder="请输入"
                v-model="fractionalRatio"
                @input="onFractionalRatio1Input"
              />%
            </view>
          </view>
        </view>
      </template>
      <template
        v-if="
          quotationRadioList[quotationRadioCurrent].value ===
          quotationRadioList[1].value
        "
      >
        <!-- 销售高级模式展示 -->
        <view
          class="set_item mgt16"
          style="text-align: right"
          @click="
            JumpPath(
              `/pages/basicSet/quotationManagementSon/strategyType?type=1&premiumVal=${premiumVal}&inputValue=${encodeURIComponent(
                is_sale_json
              )}`
            )
          "
        >
          <text style="color: #1d8c29">{{ is_sale_json || "点击输入" }}</text>
          <text class="iconfont icon-xiangyou"></text>
        </view>
      </template>
      <template
        v-if="
          quotationRadioList[quotationRadioCurrent].value ===
          quotationRadioList[2].value
        "
      >
        <!-- 销售固定价模式展示 -->
        <view class="set_item mgt16" style="text-align: right">
          <view class="input_fix_box">
            <input
              type="digit"
              v-model="is_sale_fixed_price"
              placeholder="请输入销售固定价"
            />
          </view>
        </view>
      </template>
      <!-- 固定价 不显示加减价-->
      <view
        class="set_item mgt16 flex_sb"
        v-if="
          quotationRadioList[quotationRadioCurrent].value !==
          quotationRadioList[2].value
        "
      >
        <text class="label_name">加减价</text>
        <uni-number-box
          :width="80"
          :min="-100"
          :value="premiumVal"
          :step="0.01"
          @change="premiumValDebounce"
          @blur="premiumValBlur"
        />
        <!-- <u-number-box
          v-model="premiumVal"
          :min="-100"
          :step="0.01"
          inputWidth="60"
          @change="premiumValChange"
          @blur="premiumValBlur"
          :asyncChange="true"
        ></u-number-box> -->
      </view>
      <view class="set_item mgt16 flex_sb">
        <text class="label_name">小数位数</text>
        <radio-group
          @change="pointRadioChange"
          class="radio_group point_box flex_s"
        >
          <label
            class="radio_item flex_s"
            v-for="(item, index) in pointRadioList"
            :key="item.value"
          >
            <view>
              <radio
                color="rgba(124, 24, 24, 1)"
                :value="item.value"
                :checked="index === pointRadioCurrent"
              />
            </view>
            <view>{{ item.name }}</view>
          </label>
        </radio-group>
      </view>
    </template>

    <view class="set_item mgt16 flex_sb">
      <text class="red_color">回购</text>
      <up-switch
        inactiveColor="rgb(178, 189, 194)"
        activeColor="var(--view-theme)"
        size="20"
        v-model="bakeBuySwitch"
        @change="bakeBuySwitchChange"
      ></up-switch>
    </view>

    <template v-if="bakeBuySwitch">
      <!-- 回购管理设置 -->
      <view class="set_item mgt16 flex_sb">
        <text class="label_name">报价方式</text>
        <radio-group @change="quotationRadioChange2" class="radio_group flex_s">
          <label
            class="radio_item flex_s"
            v-for="(item, index) in quotationRadioList2"
            :key="item.value"
            :class="{ active: index === quotationRadioCurrent2 }"
          >
            <view>
              <radio
                color="rgb(38, 120, 255)"
                :value="item.value"
                :checked="index === quotationRadioCurrent2"
              />
            </view>
            <view>{{ item.name }}</view>
          </label>
        </radio-group>
      </view>
      <template
        v-if="
          quotationRadioList2[quotationRadioCurrent2].value ===
          quotationRadioList2[0].value
        "
      >
        <!-- 回购默认报价方式 -->
        <view
          class="set_item mgt16 flex_sb"
          @click="
            JumpPath(
              '/pages/basicSet/quotationManagementSon/followMarket?type=2'
            )
          "
        >
          <text>跟随行情</text>
          <view class="right_info flex_s">
            <view v-if="saleMarket2.id">
              <text v-if="saleMarket2.id">{{ saleMarket2.id }}</text
              ><text v-if="saleMarket2.name">-{{ saleMarket2.name }}</text>
            </view>

            <text v-else>请选择</text>
            <text class="iconfont icon-xiangyou"></text>
          </view>
        </view>

        <view class="set_item mgt16 flex_sb">
          <text class="label_name">加减方式</text>
          <radio-group @change="premiumRadioChange2" class="radio_group flex_s">
            <label
              class="radio_item flex_s"
              v-for="(item, index) in premiumRadioList2"
              :key="item.value"
              :class="{ active: index === premiumRadioCurrent2 }"
            >
              <view>
                <radio
                  color="rgb(38, 120, 255)"
                  :value="item.value"
                  :checked="index === premiumRadioCurrent2"
                />
              </view>
              <view>{{ item.name }}</view>
            </label>
          </radio-group>
        </view>
        <view class="set_item mgt16">
          <view class="last_item flex_s">
            <view
              v-if="
                premiumRadioList2[premiumRadioCurrent2].value ==
                premiumRadioList2[0].value
              "
            >
              <text class="green_font">实时行情</text> X (<text
                class="green_font"
                >1</text
              >+<text class="blue_font">加减 </text>%) X
            </view>
            <view v-else>
              (<text class="green_font">实时行情</text>+<text class="blue_font"
                >加减 </text
              >) X
            </view>
            <view class="input_box flex_s">
              <input
                type="digit"
                placeholder="请输入"
                v-model="fractionalRatio2"
                @input="onFractionalRatio2Input"
              />%
            </view>
          </view>
        </view>
      </template>
      <!-- 回购高级报价方式展示 -->
      <template
        v-if="
          quotationRadioList2[quotationRadioCurrent2].value ===
          quotationRadioList2[1].value
        "
      >
        <!-- 销售高级模式展示 -->
        <view
          class="set_item mgt16"
          style="text-align: right"
          @click="
            JumpPath(
              `/pages/basicSet/quotationManagementSon/strategyType?type=2&premiumVal=${premiumVal2}&inputValue=${encodeURIComponent(
                is_buyback_json
              )}`
            )
          "
        >
          <text style="color: #1d8c29">{{
            is_buyback_json || "点击输入"
          }}</text>
          <text class="iconfont icon-xiangyou"></text>
        </view>
      </template>
      <template
        v-if="
          quotationRadioList2[quotationRadioCurrent2].value ===
          quotationRadioList2[2].value
        "
      >
        <!-- 销售固定值模式展示 -->
        <view class="set_item mgt16" style="text-align: right">
          <view class="input_fix_box">
            <input
              type="digit"
              v-model="is_buyback_fixed_price"
              placeholder="请输入回购固定价"
            />
          </view>
        </view>
      </template>
      <!-- 固定价 不显示加减价-->
      <view
        class="set_item mgt16 flex_sb"
        v-if="
          quotationRadioList2[quotationRadioCurrent2].value !==
          quotationRadioList2[2].value
        "
      >
        <text class="label_name">加减价</text>
        <uni-number-box
          :width="80"
          :min="-100"
          :value="premiumVal2"
          :step="0.01"
          @change="premiumVal2Debounce"
          @blur="premiumVal2Blur"
        />
        <!-- <u-number-box
          v-model="premiumVal2"
          :min="-100"
          :step="0.01"
          inputWidth="60"
          @change="premiumVal2Change"
          @blur="premiumVal2Blur"
          :asyncChange="true"
        ></u-number-box> -->
      </view>
      <view class="set_item mgt16 flex_sb">
        <text class="label_name">小数位数</text>
        <radio-group
          @change="pointRadioChange2"
          class="radio_group point_box flex_s"
        >
          <label
            class="radio_item flex_s"
            v-for="(item, index) in pointRadioList2"
            :key="item.value"
          >
            <view>
              <radio
                color="rgba(124, 24, 24, 1)"
                :value="item.value"
                :checked="index === pointRadioCurrent2"
              />
            </view>
            <view>{{ item.name }}</view>
          </label>
        </radio-group>
      </view>
    </template>
    <view class="uni-p-b-98"></view>
    <footerBtn
      :title="detailId ? '确认修改' : '确认策略'"
      @submitHandler="addStrategy"
    />
    <up-datetime-picker
      :show="timeShow1"
      v-model="time1"
      mode="time"
      @confirm="bindTimeChange1"
      @cancel="closeTime1"
      @close="closeTime1"
    >
    </up-datetime-picker>
    <up-datetime-picker
      :show="timeShow2"
      v-model="time2"
      mode="time"
      @confirm="bindTimeChange2"
      @cancel="closeTime2"
      @close="closeTime2"
    >
    </up-datetime-picker>
  </view>
</template>

<style scoped lang="scss">
.wrap {
  padding: 50rpx 40rpx 200rpx;
  border-radius: 20rpx;
  text-align: center;
  background: rgba(248, 248, 248, 1);
  .red_color {
    color: #e91414;
  }
  .editor_box {
    font-size: 30rpx;
    color: rgba(28, 28, 29, 1);
    width: 100%;
    height: 241rpx;
    border-radius: 8rpx;
    background: rgba(255, 255, 255, 1);
  }
  .btn_box {
    margin: 20rpx 0;
    .btn_item {
      font-size: 26rpx;
      margin-left: 20rpx;
      color: #fff;
      background: #272636;
      border-radius: 99rpx;
    }
  }
  .tip_box {
    color: rgba(125, 136, 140, 1);
    font-size: 28rpx;
    line-height: 43rpx;
    text-align: left;
  }
  .set_item {
    background: #fff;
    padding: 40rpx;
    color: rgba(39, 38, 54, 1);
    font-size: 30rpx;
    .input_fix_box {
      // border: 1px solid #999;
      // border-radius: 20rpx;
      // padding: 10rpx 0;
    }
    .label_name {
      margin-right: 30rpx;
      flex-shrink: 0;
    }
    .last_item {
      width: 100%;
      flex-wrap: nowrap;
      .green_font {
        color: #1d8c29;
      }
      .blue_font {
        color: rgba(38, 120, 255, 1);
      }
      .input_box {
        width: 155rpx;
        padding: 10rpx 10rpx;
        border-radius: 6rpx;
        margin-left: 10rpx;
        background: rgba(248, 248, 248, 1);
        input {
          text-align: left;
          font-size: 24rpx;
        }
      }
    }
    .right_info {
      font-size: 28rpx;
      color: #1d8c29;
      .iconfont {
        font-weight: bold;
        font-size: 24rpx;
        margin-left: 10rpx;
        color: #272636;
      }
    }
    .radio_group {
      flex-wrap: wrap;
      .radio_item {
        &:not(:first-child) {
          margin-left: 20rpx;
        }
      }
      .active {
        color: rgb(38, 120, 255);
      }
    }
    .point_box {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10rpx 15rpx;
      .radio_item {
        margin-left: unset !important;
      }
    }
    .iconfont {
      margin-left: 10rpx;
      font-weight: bold;
      font-size: 30rpx;
    }
  }
  .pop_time {
    position: relative;
    background: #fff;
    width: 670rpx;
    margin: 0 auto;
    padding: 30rpx 0;
    border-radius: 11rpx;
    .time_pop_item {
      width: 40%;
      flex-grow: 1;
      color: rgba(125, 136, 140, 1);
      font-size: 28rpx;
    }
    .line {
      width: 2rpx;
      height: 60rpx;
      background: rgba(244, 243, 243, 1);
    }
  }

  .tab_list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20rpx;
    margin-bottom: 30rpx;
    .tab_item {
      background: #fff;
      border-radius: 11rpx;
      font-size: 30rpx;
      color: rgba(46, 46, 46, 1);
    }
    .active {
      background: var(--view-theme);
    }
  }
}
</style>
